package StudyCode.summary.Basic;

import java.util.Scanner;

/**
 * 版权所有 科技与人文(www.tah1986.com)
 */
public class QuadraticEquationSolver {
	public static void main(String[] arg) {
		Scanner keyboard = new Scanner(System.in);

		System.out.print("(ax^2+bx+c=0)请输入 a,b,c ");
		double a = keyboard.nextDouble();
		double b = keyboard.nextDouble();
		double c = keyboard.nextDouble();

		double delta = b * b - 4.0 * a * c;
		double root1, root2;

		if (delta >= 0) {
			root1 = (-b - Math.sqrt(delta)) / (2.0 * a);
			root2 = (-b + Math.sqrt(delta)) / (2.0 * a);
			System.out.println("两个解分别是" + root1 + " " + root2);
		} else {
			System.out.println("无解.");
		}
	}
}
